<?php

namespace App\Models\Traits;

trait BlindBoxTrait
{
	public  function maxProductPrice()
	{
		$max = !empty($this->productPrice()) ? max($this->productPrice()) : 0; 
		
		return $max;
	}

	public  function minProductPrice()
	{
		$min = !empty($this->productPrice()) ? min($this->productPrice()) : 0; 
		
		return $min;
	}

	public function productPrice()
	{

		$products = $this->blindBoxProducts;
		
		$prices = [];
		foreach($products as $value){

			$prices[] = $value->product->price_market;
		}

		return $prices;
	}
	
	
}
